f7ccf15d8dd8ace93d2adcf5a49ba10877be68a5,clc/modules/msgs/src/main/java/com/eucalyptus/upgrade/Upgrades.java,Upgrades,runSchemaUpdate,#DatabaseFilters#,1117
Before Change
PersistenceContexts.listEntities( ctx ),
props
);
new SchemaUpdate(PersistenceContexts.getConfiguration( config )).execute(true, true);
}
} catch ( final Exception e ) {
LOG.fatal( e, e );
After Change
PersistenceContexts.listEntities( ctx ),
props
);
final Configuration configuration = PersistenceContexts.getConfiguration( config );
final File configDigestFile = SubDirectory.RUNDB.getChildFile( ctx + ".cfg.sha256" );
final ByteArrayOutputStream output = new ByteArrayOutputStream( 4096 );
final ObjectOutputStream outputObject = new ObjectOutputStream( output );
outputObject.writeObject( configuration ); // when using Java 7 the EntityTuplizerFactory/ConcurrentHashMap can
outputObject.flush( ); // cause spurious hash differences. This occurs much less with Java 8.
final String digest = BaseEncoding.base16().lowerCase( )
.encode( Digest.SHA256.digestBinary( output.toByteArray( ) ) );
final boolean upgrade = BootstrapArgs.isUpgradeSystem( ) || isForceUpgrade( );
if ( upgrade ||
!configDigestFile.canRead( ) ||
!digest.equals( Files.toString( configDigestFile, StandardCharsets.UTF_8 ) ) ) {
LOG.info( "Running schema update for " + ctx );
new SchemaUpdate( configuration ).execute( false, true );
if ( upgrade ) {
if ( configDigestFile.exists( ) && !configDigestFile.delete( ) ) {
LOG.warn( "Unable to delete configuration digest file: " + configDigestFile.getAbsolutePath( ) );